package com.huitone.gddw.controller.monitoring;


import java.util.Map;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.huitone.gddw.dao.entity.OracleItem;
import com.huitone.gddw.dao.entity.ReturnedValue;
import com.huitone.gddw.service.OracleItemService;

import com.huitone.gddw.utils.MonitoringResult;

/**
 * Oracle监控Controller
 * @author lipengfei
 *
 */
@Controller
@RequestMapping(value="oraclemmon")
public class OracleMonitoringController {
	private final static Logger LOGGER = Logger.getLogger(OracleMonitoringController.class);
	@Resource
	OracleItemService oracleServer;
	
	
	@ResponseBody
	@RequestMapping(value="/showOracle",method=RequestMethod.POST)
	public MonitoringResult<Map<String, Object>> show(ReturnedValue returnedValue){
		MonitoringResult<Map<String, Object>> result = 
				oracleServer.loadOracle(returnedValue);
		LOGGER.info("显示redis监控数据完成");
		return result;
	}
	
	@ResponseBody
	@RequestMapping(value="/addIndex",method=RequestMethod.POST)
	public MonitoringResult<Map<String,Object>> showIndex(ReturnedValue value){
		MonitoringResult<Map<String,Object>> result = 
				oracleServer.showIndex(value);
		LOGGER.info("获得指标数据完成");
		return result;
	}
	@ResponseBody
	@RequestMapping(value="/saveIndex",method=RequestMethod.POST)
	public MonitoringResult<OracleItem> saveIndex(ReturnedValue value){
		MonitoringResult<OracleItem> result = 
				oracleServer.save(value);
		LOGGER.info("保存指标数据完成");
		return result;
	}
//	@ResponseBody
//	@RequestMapping(value="/updataIndex",method=RequestMethod.POST)
//	public MonitoringResult<Map<String,Object>> updataIndex(ReturnedValue value){
//		MonitoringResult<Map<String,Object>> result = 
//				oracleServer.updata(value);
//		LOGGER.info("保存指标数据完成");
//		return result;
//	}
}
